load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")

go_library(
    name = "staleread",
    srcs = [
        "errors.go",
        "failpoint.go",
        "processor.go",
        "provider.go",
        "util.go",
    ],
    importpath = "github.com/pingcap/tidb/pkg/sessiontxn/staleread",
    visibility = ["//visibility:public"],
    deps = [
        "//pkg/config",
        "//pkg/domain",
        "//pkg/expression",
        "//pkg/infoschema",
        "//pkg/kv",
        "//pkg/parser/ast",
        "//pkg/parser/mysql",
        "//pkg/planner/planctx",
        "//pkg/planner/util",
        "//pkg/sessionctx",
        "//pkg/sessionctx/stmtctx",
        "//pkg/sessionctx/variable",
        "//pkg/sessiontxn",
        "//pkg/sessiontxn/internal",
        "//pkg/table/temptable",
        "//pkg/types",
        "//pkg/util/dbterror/plannererrors",
        "@com_github_pingcap_errors//:errors",
        "@com_github_pingcap_failpoint//:failpoint",
        "@com_github_tikv_client_go_v2//oracle",
    ],
)

go_test(
    name = "staleread_test",
    timeout = "short",
    srcs = [
        "externalts_test.go",
        "main_test.go",
        "processor_test.go",
        "provider_test.go",
    ],
    flaky = True,
    shard_count = 6,
    deps = [
        ":staleread",
        "//pkg/domain",
        "//pkg/infoschema",
        "//pkg/kv",
        "//pkg/parser",
        "//pkg/parser/ast",
        "//pkg/parser/auth",
        "//pkg/sessionctx",
        "//pkg/sessiontxn",
        "//pkg/store/mockstore",
        "//pkg/table/temptable",
        "//pkg/testkit",
        "//pkg/testkit/testsetup",
        "@com_github_pingcap_errors//:errors",
        "@com_github_pingcap_failpoint//:failpoint",
        "@com_github_stretchr_testify//require",
        "@com_github_tikv_client_go_v2//oracle",
        "@com_github_tikv_client_go_v2//tikv",
        "@org_uber_go_goleak//:goleak",
    ],
)
